<template>
  <div class="article-page">
     <div class="head">
        <img src="../../assets/image/ic_back_black.png" alt="" @click="back">
        <div class="title">文章详情</div>
     </div>
    <div v-html="content(consultList.content)" class="contents"></div>
  </div>
</template>

<script>
import { contentsData } from "../../sever/request";
export default {
  data() {
    return {
      consultList: [],
      token: "123",
      id:'1',
    };
  },
  mounted() {
    let store = this.$route.query;
    if (store.shop_id != undefined) {
      this.shop_id = store.shop_id;
    }
    if (store.token != "" && store.token != undefined) {
      this.token = store.token;
    }
    // this.token = uni.getStorageSync("userInfo").token;
    if(store.id!=undefined){
      this.id=store.id
      console.log(store.id)
    }
    
    this.getConsult();
  },
  created() {
    
  },
  methods: {
    content(str){
			      var content = str.replace(/<img/g, '<img style="max-width:100%;height:auto;display:block"').replace(/\\/g, '')
			      return content;
			},
    getConsult() {
      console.log(this.id)
      contentsData({
        id:this.id,
        token: this.token,
      }).then((res) => {
        if (res.data.code === 1) {
          this.consultList = res.data.data;
        }
      });
    },
    back(){
       this.$router.go(-1)
      // uni.navigateBack();
    },
  },
};
</script>
<style lang="less" scoped>
   .article-page{
     background-color: #f6f6f6;
     .head{
          display: flex;
          justify-content: flex-start;
          align-items: center;
          padding: .933333rem 0 .266667rem;
          width: 10rem;
          background: #fff;
          	box-shadow: 0px .106667rem .213333rem rgba(0, 0, 0, 0.08);
          position: fixed;
          top: 0;
          left: 0;
          z-index: 10;
          img{
            width: .266667rem;
            height: .4rem;
            margin-left: .4rem;
          }
          .title{
            font-size: .4rem;
            color: #333;
            font-weight: 600;
            margin-left: 3.6rem;
          }
     }
     .contents{
       margin: 2.133333rem .133333rem 0 .133333rem;
     }
   }
</style>